@extends('admin.base')


@section('content')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-calendar"></i>
            商品类别添加
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">信息管理</a></li>
            <li class="active">添加信息</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- right column -->
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><i class="fa fa-plus"></i> 添加分类信息</h3>
                    </div><!-- /.box-header -->
                    <!-- form start -->
                    <form class="form-horizontal" action="{{URL('admin/category')}}" method="post">
                        {{csrf_field()}}
                        <div class="box-body">
                                <div class="form-group">
                                    <label for="inputPassword3" class="col-sm-2 control-label">父类名称</label>
                                    <div class="col-sm-4">
                                        <select  name="cate_pid" class="form-control">
                                            <option value="">全部</option>
                                        @foreach($list as $v)
                                                @if($data->cate_pid == $v->cate_id)
                                                    <option selected value="{{$v->cate_id}}">
                                                        <?php echo str_repeat("&nbsp;",4*$v->level);?>{{$v->cate_name}}</option>
                                                @else
                                                    <option  value="{{$v->cate_id}}"><?php echo str_repeat("&nbsp;",4*$v->level);?>{{$v->cate_name}}</option>
                                                @endif
                                        @endforeach
                                        </select>
                                    </div>
                                </div>
                            <div class="form-group">
                                <label for="inputPassword3" class="col-sm-2 control-label">类别名称</label>
                                <div class="col-sm-4">
                                    <input type="text" name="cate_name" class="form-control">
                                </div>
                            </div>
                        </div><!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-offset-2 col-sm-1">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                            <div class="col-sm-1">
                                <button type="submit" class="btn btn-primary">重置</button>
                            </div>
                        </div><!-- /.box-footer -->
                    </form>
                    <div class="row"><div class="col-sm-12">&nbsp;</div></div>
                    <div class="row"><div class="col-sm-12">
                            <br/>
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                        </div></div>
                </div><!-- /.box -->

            </div><!--/.col (right) -->
        </div>   <!-- /.row -->
    </section><!-- /.content -->

@endsection